<script setup lang="ts">
import { onMounted, ref } from "vue";
import { GameManager } from "./gameManager";
import { LocalStorageManager } from "./storageManager";
import { HTMLActuator } from "./htmlActuator";
const gameManager = ref<any>();
const tileContainerRef = ref();
const boxContainerRef = ref();
const overRef = ref();

onMounted(() => {
  const storage = new LocalStorageManager(); //初始化存储管理器,存分数和最好分数
  const htmlActuator = new HTMLActuator(
    tileContainerRef.value,
    overRef.value,
    boxContainerRef.value
  );
  gameManager.value = new GameManager(htmlActuator, storage);
});
</script>

<template>
  <div id="guide-panel" class="container flex-center flex-col">
    <div ref="overRef" class="over-container"></div>
    <div class="game-box" ref="boxContainerRef" id="game-box">
      <div ref="tileContainerRef" class="pao-container"></div>
      <div id="guide-arrow"></div>
      <div id="shooter-pao"></div>
    </div>
  </div>
</template>
<style lang="less" src="./paopao.less"></style>
<style scoped lang="less">
.container {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

.game-box {
  position: relative;
  background-color: transparent;
  background: rgb(228, 255, 192);
  overflow: hidden;

  #guide-arrow {
    width: 20px;
    height: 80px;
    background: url("./images/a2.png") left top no-repeat;
    position: absolute;
    left: 50%;
    bottom: 15px;
    transform: translateX(-50%);
    transform-origin: center bottom;
    z-index: 3;
  }

  #shooter-pao {
    width: 30px;
    height: 30px;
    // background: red;
    border: 1px solid red;
    border-radius: 50%;
    position: absolute;
    left: 50%;
    bottom: 0px;
    transform: translateX(-50%);
    z-index: 4;
  }
}

.over-container {
  width: auto;
  height: auto;
  padding: 20px;
  background: pink;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: -1;
}
</style>